#include<stdio.h>
#include<string.h>
#include<stdlib.h>

static char* compress(char* src)
{
	char* s = (char*)malloc(strlen(src) + 1);
	if (s != NULL) {
		int len = strlen(src);
		int k = 0;
		int n1, n2;
		for (int i = 0, j = 0; i < len; i = j) {
			int num = 0;
			while (src[i] == src[j]) {
				num++;
				j++;
			}
			if (num >= 3 && num < 10) {
				s[k++] = src[i];
				s[k++] = num + '0';
			}
			else if (num < 3) {
				for (int p = 0; p < num; p++) {
					s[k++] = src[i];
				}
			}
			else if (num >= 10) {
				s[k++] = src[i];
				n1 = num % 10;
				num /= 10;
				n2 = num % 10;
				s[k++] = n2 + '0';
				s[k++] = n1 + '0';
			}
		}
		s[k] = '\0';
	}
	return s;
}
int main()
{
	char src[100];
	scanf_s("%s", src, 100);

	char* ps = compress(src);

	puts(ps);
	return 0;
}